<?php
/**
*作用:
*说明:
*版权:
*作者:Red	QQ:316765128
*时间:2011/7/28
**/
include_once './include/init.inc.php';

//red add
$c = (empty($_GET['c']) or !is_numeric($_GET['c']))?'':$_GET['c'];
$smarty->assign('c',$c);

//水族
//最后一级分类罗列
$sql = "select c.cat_id,c.cat_name,count(gc.cat_id) as num from `info_category` as c left outer join `info_goods` as gc on c.cat_id=gc.cat_id where (c.parent_id=44 or c.parent_id=114) and c.cat_id<>'114' and gc.is_delete = 0 AND gc.is_on_sale = 1 group by c.cat_id order by c.sort_order desc";
$red_sz = $db->fetch_all($sql);
$smarty->assign('red_sz',       $red_sz);

$sql = 'select * from `info_goods` WHERE ';
if($c==''){
	$sql .= "cat_id in (115,116,117,118,119,120,121,122,123,124,125,126)";
}else{
	$sql .= 'cat_id='.$c;
}

$dog_all = $db->fetch_all($sql);
$dogs = array();
$i=0;
foreach($dog_all as $key=>$val){
	$attr = array();
	$attr = get_goods_properties($val['goods_id'],$db); //属性
	$val['attr'] = @array_reverse($attr['pro']['商品属性']);
	$val['attr'] = @array_slice($val['attr'], 0, 4);
	if($i==3){
		$i = 0;
	}
	$val['num'] = $i;
	$dogs[] = $val;
	++$i;
}
$smarty->assign('dogs',       $dogs);
$smarty->assign('dog_num',       count($dog_all));

$sortname = '水族 (100)';
$smarty->assign('sortname',       $sortname);

$smarty->assign('nav','daquan');
fheader();
$smarty->display('list_sz.dwt');
ffooter();